# @author        Liang Huanyan
# @email         lianghuanyan@alientek.com
# http://www.openedv.com/forum.php

cmake_minimum_required(VERSION 3.8)
message(STATUS "cmake version ${CMAKE_VERSION}")

set(TOOLCHAIN_DIR /opt/atk-dlrv1126-toolchain)
set(CMAKE_CXX_COMPILER ${TOOLCHAIN_DIR}/usr/bin/arm-linux-gnueabihf-g++)
set(CMAKE_C_COMPILER ${TOOLCHAIN_DIR}/usr/bin/arm-linux-gnueabihf-gcc)

set(SYSROOT /home/jack/rv1126doc/sysroot/usr/include)
set(CMAKE_SYSROOT /home/jack/rv1126doc/sysroot)

set(CMAKE_CXX_STANDARD 11)
add_definitions(-g -O0 -ggdb -gdwarf -funwind-tables -rdynamic)
add_definitions(-Wno-write-strings -Wno-return-type)

set(OPENCV_LIBS opencv_core opencv_imgcodecs opencv_imgproc opencv_features2d opencv_flann opencv_highgui opencv_freetype)
set(RKMEDIA_LIBS easymedia rga rkaiq rockx sample_common_isp sqlite3)
set(FFMPEG_LIBS avformat avcodec swresample avutil x264)


include_directories(${SYSROOT})
include_directories(${SYSROOT}/rga)
include_directories(${SYSROOT}/easymedia)
include_directories(${SYSROOT}/rkaiq/uAPI)
include_directories(${SYSROOT}/rkaiq/xcore)
include_directories(${SYSROOT}/rkaiq/algos)
include_directories(${SYSROOT}/rkaiq/common)
include_directories(${SYSROOT}/rkaiq/iq_parser)
include_directories(${SYSROOT}/rockx)
include_directories(.)

add_definitions(-DRKAIQ)
#add_definitions(-DEBUG)

file(GLOB RKMEDIA_CPP ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
set(DB_MAIN face_sqlite3.cpp ./import_face_data/import_face_data_db_main.cpp)

project(rockx_ffmpeg_rtmp)
add_executable(rockx_ffmpeg_rtmp ${RKMEDIA_CPP})
add_executable(import_face_data_db_main ${DB_MAIN})
target_link_libraries(rockx_ffmpeg_rtmp ${OPENCV_LIBS} ${RKMEDIA_LIBS} ${FFMPEG_LIBS} pthread dl)
target_link_libraries(import_face_data_db_main ${OPENCV_LIBS} ${RKMEDIA_LIBS} pthread dl)